package com.hwh.controller;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.hwh.daoIm.BuyersDaoImp;
import com.hwh.vo.Buyers;

public class SelBuyerByIdController extends HttpServlet{

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		super.doPost(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		int buy_id = 4;
		Buyers buyer = new Buyers();
		ArrayList<Buyers> buyers = new ArrayList<Buyers>();
		BuyersDaoImp bdi = new BuyersDaoImp();

		buyer = bdi.getBuyersBuyid(buy_id);
		buyers.add(buyer);
		// 将stores对象放入session中,前台用EL表达式获取值
		HttpSession session = req.getSession();

		session.setAttribute("buyers", buyers);

		req.getRequestDispatcher("mymessage.jsp").forward(req, resp);

	}
	
}
